import { Injectable } from '@angular/core';

import { NzMessageService } from 'ng-zorro-antd/message';

/**
 * Async modal dialog service
 * DialogService makes this app easier to test by faking this service.
 * TODO: better modal implementation that doesn't use window.confirm
 */
@Injectable()
export class MessageService {
    constructor(private message: NzMessageService) { }

    /**
     * Shows a error message.
     * @param msg The string of the message content.
     */
    showError(msg: string): void {
        this.message.create('error', msg);
    }

    /**
     * Shows a warning message.
     * @param msg The string of the message content.
     */
    showWarning(msg: string): void {
        this.message.create('warning', msg);
    }

    /**
     * Shows a info message.
     * @param msg The string of the message content.
     */
    showInfo(msg: string): void {
        this.message.create('info', msg);
    }
}